import { useUserStore, useMenuStore, useTabsStore, usePublicStore } from "@/stores";

/**
 * 获取常用的状态数据
 */
export const useCommonStore = () => {
    // 权限
    const permissions = useUserStore((state) => state.permissions);
    // 菜单是否收缩
    const isCollapsed = useMenuStore((state) => state.isCollapsed);
    // 标签栏
    const tabs = useTabsStore((state) => state.tabs);
    // 菜单数据
    const menuList = useMenuStore((state) => state.menuList);
    // 用户名
    const username = useUserStore((state) => state.userInfo.username);
    // 导航数据
    const nav = useTabsStore((state) => state.nav);
    // 是否重新加载
    const isRefresh = usePublicStore((state) => state.isRefresh);
    // 菜单打开的key
    const openKeys = useMenuStore((state) => state.openKeys);
    // 菜单选中的key
    const selectedKeys = useMenuStore((state) => state.selectedKeys);
    // 是否窗口最大化
    const isMaximize = useTabsStore((state) => state.isMaximize);
    // 是否全屏
    const isFullscreen = usePublicStore((state) => state.isFullscreen);
    // 主题
    const theme = usePublicStore((state) => state.theme);

    return {
        permissions,
        isCollapsed,
        tabs,
        menuList,
        username,
        nav,
        isRefresh,
        openKeys,
        selectedKeys,
        isMaximize,
        isFullscreen,
        theme,
    } as const;
};
